package gcj2012.round3;


import java.util.Arrays;
import java.util.Comparator;

import org.korifey.ffalg.Pair;
import org.korifey.ffalg.Sorts;

import common.AbstractRunner;
import common.AbstractRunner.SIZE;

public class A extends AbstractRunner {
		
	
	@Override
	public void handleCase(int caseNumber) throws Exception {		
		int n = scanner.nextInt();
		final int[] len = new int[n];
		Pair<Integer, Integer>[] prob2num = new Pair[n]; 
		for (int i=0; i<n; i++) {
			len[i] = scanner.nextInt();
		}
		for (int i=0; i<n; i++) {
			prob2num[i] = new Pair<Integer, Integer>(100-scanner.nextInt(), i);
		}
		Arrays.sort(prob2num, new Comparator<Pair<Integer, Integer>>() {

			@Override
			public int compare(Pair<Integer, Integer> o1,
					Pair<Integer, Integer> o2) {
				int c = 100*(len[o1.B()] - len[o2.B()]) 
						- (len[o1.B()] * o2.A() - len[o2.B()]*o1.A());
				return c == 0 ? o1.B().compareTo(o2.B()) : c/Math.abs(c);
			}
			
		});
		
		
		for (int i=0; i<n; i++) {
			if (i!=0) out.write(" ");
			out.write(prob2num[i].B()+"");
		}
		//TODO large
		out.write("\n");
	}
	
	public static void main(String[] args) throws Exception {
		new A().init(SIZE.large).execute();
	}
}

